<?php
$_DBSite = "Master";
include_once($_SERVER["DOCUMENT_ROOT"]."/db.inc.php");

function TransField($strField, $strTable){
	global $_ConnMaster;
	$strSQL = "select ID, ".$strField."_1 as Field from `".$strTable."`";
	if(!$RS = PMA_mysql_query($strSQL, $_ConnMaster)){
		print "Error: ".PMA_mysql_error($_ConnMaster)."<br>";
		print "SQL: ".$strSQL."<br>";
		return;
	}

	while($Rows = PMA_mysql_fetch_object($RS)){
		$Field_GB = iconv("BIG5", "GB2312", $Rows -> Field);
		$strSQL = "update `".$strTable."` set ".$strField."_3 = '".$Field_GB."' where ID = ".$Rows -> ID;
		if(!PMA_mysql_query($strSQL, $_ConnMaster)){
			print "Error: ".PMA_mysql_error($_ConnMaster)."<br>";
			print "SQL: ".$strSQL."<br>";
		}
	}

	print $strTable." OK<br>";
}

TransField("Type_Value", "bet_BetType");
TransField("TypeName", "bet_GambleType");
TransField("Sites", "bet_MarqueeSite");
?>